package com.project.uitl;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

public class DaoFactory {


    private static Properties pro = new Properties();

    static {
        try {
            pro.load(new FileReader("dao.txt"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static Object getDao(String daoName) {
        String str = pro.getProperty(daoName);
        try {

            Class c = Class.forName(str);
            return c.getConstructor().newInstance();
        } catch (Exception e) {

        }
        return null;
    }
}
